package hehe.container.definition.node;

import hehe.container.definition.Element;
import hehe.container.definition.node.Node;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * xml List标签节点解析类
 *<B>说明：</B>
 *<pre>
 * 略
 *</pre>
 *<B>示例：</B>
 *<pre>
 *  略
 *</pre>
 *<B>日志：</B>
 *<pre>
 *  略
 *</pre>
 *<B>注意事项：</B>
 *<pre>
 *  略
 *</pre>
 */
public class ListNode extends Node
{
    @Override
    public Object parse(Element ele)
    {
        List<Map<String,Object>> attrs = (ArrayList<Map<String,Object>>)ele.getChildNode();
        List<Object> values = new ArrayList<>();
        Element entryEle;

        for (int i = 0,j = attrs.size(); i < j;i++) {
            Map<String,Object> entry = attrs.get(i);
            entryEle = Element.make(entry);
            values.add(entryEle.getValue());
        }

        return values;
    }
}
